/*
 *  multimedia_info.h
 *
 *  Library for reading metadata in multimedia files.
 *  Currently only MP3s are supported with MPLIB.  These functions
 *  are an Opqaue model for using multiple libraries, in order to support
 *  multiple media types.
 *
 * Support:
 *    MP3: Supported (Define: USE_MPLIB, -lmp)
 *    All Other Media: Not Yet, Supported
 *
 * Copyright (c) 2006 Karlan Thomas Mitchell<karlanmitchell@gmail.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, is prohibited except by
 * Karlan Thomas Mitchell.
 *
 * THIS SOFTWARE IS PROVIDED BY KARLAN THOMAS MITCHELL AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
 
/*
Here is a simple example, this library should be REALLY EASY to use!
*/


/*

#include <stdio.h>
#include <stdlib.h>
#include "multimedia_info.h"


int main(int argc, char * argv[]){

	if(argc == 1){
		printf("Please pass a media file as an argument!\n");
		return -1;
		}

	char buffer[1024];

	struct st_mminfo mminfo;

 	mminfo_load(&mminfo, argv[1]);


	mminfo_get(&mminfo, MM_TITLE, buffer, 1024);
	printf("Title:  %s\n", buffer);

	mminfo_get(&mminfo, MM_ALBUM, buffer, 1024);
	printf("Album:  %s\n", buffer);

	mminfo_get(&mminfo, MM_YEAR, buffer, 1024);
	printf("Year:   %s\n", buffer);

	mminfo_get(&mminfo, MM_GENRE, buffer, 1024);
	printf("Genre:  %s\n", buffer);

	mminfo_get(&mminfo, MM_TRACK, buffer, 1024);
	printf("Track:  %s\n", buffer);


	mminfo_getstr(&mminfo, "%bitrate kb/s %artist - %album - %title in %year", buffer, 1024);
	printf("String Example: %s\n", buffer);

	return 0;
	}

*/


#ifndef ___MULTIMEDIA_INFO_H__
#define ___MULTIMEDIA_INFO_H__
#include <string.h>
#include <stdio.h>
#include "string.h"
#include <stdlib.h>

#ifdef USE_MPLIB
#include <mplib.h>
#endif

/*Supported Types*/
#define MMTYPE_UNDEF -1
#define MMTYPE_MP3 0

/*Currently unsupported Types*/
#define MMTYPE_M4A 1
#define MMTYPE_OGG 2
#define MMTYPE_MPG 3
#define MMTYPE_MOV 4
#define MMTYPE_AVI 5
#define MMTYPE_WMV 6



/*Supported fields*/
#define MM_ARTIST  0
#define MM_ALBUM   1
#define MM_TITLE   2
#define MM_TRACK   3
#define MM_YEAR    4
#define MM_GENRE   5
#define MM_BITRATE 6

/*Currently unsupported fields*/
#define MM_LENGTH  99

/*Opaque structure for holding tag information for many types of media*/
struct st_mminfo {
	
	int media_type;

	#ifdef USE_MPLIB
	id3_tag_list * mp3_info;
	mpeg_header * mpeg_info;
	#endif


	};



int mminfo_type(const char * filename);
int mminfo_load(struct st_mminfo * mminfo, const char * filename);
int mminfo_resolv(int field, struct st_mminfo * mminfo);
int mminfo_get(struct st_mminfo * mminfo, int field, char * buffer, size_t len);
int mminfo_getstr(struct st_mminfo * mminfo, char * fieldstr, char * buffer, size_t len);
#endif
